//完全数计算
//https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84?tpId=37&tqId=21279&ru=/exam/oj
#include <iostream>
#include<cmath>
using namespace std;
 
bool get_div_num(int n)
{
    int sum=1;
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            sum+=i;
            //去掉重复的约数
            if(n/i!=i)
            {
                sum+=n/i;
            }
        }
    }
    return sum==n;
}
int main() {
    int n=0;
    while(cin>>n)
    {
        int count=0;
        for(int i=2;i<=n;i++)
        {
            if(get_div_num(i))
            {
                count++;
            }
        }
        cout<<count<<endl;
    }
    return 0;
}